package com.example.societiesSystem.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.societiesSystem.common.R;
import com.example.societiesSystem.dto.ActivityLogsAddDTO;
import com.example.societiesSystem.entity.ActivityPersonnelRecording;
import com.example.societiesSystem.service.IActivityPersonnelRecordingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 社团活动人员记录表 前端控制器
 * </p>
 *
 * @author 周欢
 * @since 2025-05-27
 */
@Api(tags = "社团活动人员记录表 前端控制器")
@CrossOrigin
@RestController
@RequestMapping("/activeLogs")
public class ActivityPersonnelRecordingController {

    @Resource
    private IActivityPersonnelRecordingService activityPersonnelRecordingService;

    @ApiOperation(value = "根据活动id查询")
    @GetMapping("/list")
    public R list(@RequestParam("activeId") Long activeId) {
        return R.data(activityPersonnelRecordingService.getBaseMapper().selectList(
                new LambdaQueryWrapper<ActivityPersonnelRecording>()
                        .eq(ActivityPersonnelRecording::getActiveId,activeId)
        ));
    }

    @ApiOperation(value = "社团活动申请信息添加")
    @PostMapping("/add")
    public R add(@RequestBody ActivityLogsAddDTO activityLogsAddDTO) {
        return R.data(activityPersonnelRecordingService.add(activityLogsAddDTO));
    }
}
